from django.contrib import admin
from .models import Post

# Register your models here.

class PostAdmin(admin.ModelAdmin):
    list_display = ('title','slug','published','status',)
    list_filter = ('status','created','published','author',)
    search_fields = ('title','body',)
    prepopulated_fields = {'slug':('title',),}  #当slug填写数据的同时，title也同时被填充，数据一致
    raw_id_fields = ('author',)
    date_hierarchy = 'published'
    ordering = ['status','published']


admin.site.register(Post,PostAdmin)  # 注册, 让django后台管理Post类